package com.jo.register;

import com.google.common.collect.Lists;
import com.jo.interceptor.AdviseAdapter;
import com.jo.interceptor.BeforeMethodAdapter;
import lombok.Getter;

import java.util.List;

/**
 * 默认的advice适配器工厂，提供默认的适配器，参考spring的实现
 * spring中是有一个GlobalAdvisorAdapterRegistry存放此实例
 * @author Jo
 * @date 2018/1/26
 */
@Getter
public class DefaultAdviseAdapterRegister {
    protected List<AdviseAdapter> adviseAdapters=  Lists.newArrayList();

    private void registerAdviseAdapter(BeforeMethodAdapter beforeMethodAdapter) {
        adviseAdapters.add(beforeMethodAdapter);
    }

    public DefaultAdviseAdapterRegister() {
        registerAdviseAdapter(new BeforeMethodAdapter());
    }
}
